package com.hhq.sso.protocol.oauth2.entity;

import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;

import java.time.Instant;

/**
 * <p>
 * Description: 授权信息
 * </p>
 *
 * @author : xiaodong.yang
 * @date : 2024/6/14 18:29
 */
@Entity
@Table(name = "`authorization`")
@Setter
@Getter
public class Authorization {
    @Id
    @Column
    private String id;
    /**
     * 注册客户端id
     */
    private String registeredClientId;
    /**
     * 主体名称
     */
    private String principalName;
    /**
     * 授权类型
     */
    private String authorizationGrantType;
    /**
     * 授权范围
     */
    @Column(length = 1000, columnDefinition = "TEXT")
    private String authorizedScopes;
    /**
     * 属性
     */
    @Column(length = 4000, columnDefinition = "TEXT")
    private String attributes;
    /**
     * 状态
     */
    @Column(length = 500)
    private String state;
    /**
     * 授权码值
     */
    @Column(length = 4000, columnDefinition = "TEXT")
    private String authorizationCodeValue;
    /**
     * 授权码生成瞬间值
     */
    private Instant authorizationCodeIssuedAt;
    /**
     * 授权码过期时间
     */
    private Instant authorizationCodeExpiresAt;

    /**
     * 授权码源数据
     */
    private String authorizationCodeMetadata;

    /**
     * acessToken值
     */
    @Column(length = 4000, columnDefinition = "TEXT")
    private String accessTokenValue;
    /**
     * acessToken生成时间
     */
    private Instant accessTokenIssuedAt;
    /**
     * acessToken过期时间
     */
    private Instant accessTokenExpiresAt;
    /**
     * acessToken源数据
     */
    @Column(length = 2000, columnDefinition = "TEXT")
    private String accessTokenMetadata;
    /**
     * acessToken类型
     */
    private String accessTokenType;
    /**
     * acessToken范围
     */
    @Column(length = 1000, columnDefinition = "TEXT")
    private String accessTokenScopes;
    /**
     * refreshToken值
     */
    @Column(length = 4000, columnDefinition = "TEXT")
    private String refreshTokenValue;
    /**
     * refreshToken生成时间
     */
    private Instant refreshTokenIssuedAt;
    /**
     * refreshToken过期时间
     */
    private Instant refreshTokenExpiresAt;
    /**
     * refreshToken源数据
     */
    @Column(length = 2000, columnDefinition = "TEXT")
    private String refreshTokenMetadata;
    /**
     * oidcIdToken值
     */
    @Column(length = 4000, columnDefinition = "TEXT")
    private String oidcIdTokenValue;
    /**
     * oidcIdToken生成时间
     */
    private Instant oidcIdTokenIssuedAt;
    /**
     * oidcIdToken过期时间
     */
    private Instant oidcIdTokenExpiresAt;
    /**
     * oidcIdToken源数据
     */
    @Column(length = 2000, columnDefinition = "TEXT")
    private String oidcIdTokenMetadata;

    /**
     * oidcIdToken源数据
     */
    @Column(length = 2000, columnDefinition = "TEXT")
    private String oidcIdTokenClaims;

    /**
     * userCode值
     */
    @Column(length = 4000, columnDefinition = "TEXT")
    private String userCodeValue;
    /**
     * userCode生成时间
     */
    private Instant userCodeIssuedAt;
    /**
     * userCode过期时间
     */
    private Instant userCodeExpiresAt;
    /**
     * userCode源数据
     */
    @Column(length = 2000, columnDefinition = "TEXT")
    private String userCodeMetadata;
    /**
     * deviceCode值
     */
    @Column(length = 4000, columnDefinition = "TEXT")
    private String deviceCodeValue;
    /**
     * deviceCode生成时间
     */
    private Instant deviceCodeIssuedAt;
    /**
     * deviceCode过期时间
     */
    private Instant deviceCodeExpiresAt;
    /**
     * deviceCode源数据
     */
    @Column(length = 2000, columnDefinition = "TEXT")
    private String deviceCodeMetadata;
}
